//Source file: D:\\WTK104\\apps\\Toddtris\\src\\com\\toddsoft\\toddtris\\midlet\\KeyHandler.java

package com.toddsoft.toddtris.midlet;

import javax.microedition.lcdui.Canvas;

abstract class KeyHandler {
    public static final int LEFT = 1;
    public static final int RIGHT = 2;
    public static final int CLOCKWISE = 3;
    public static final int ANTICLOCKWISE = 4;
    public static final int DOWN = 5;
    public static final int DROP = 6;
    
    /**
     * @param keyCode
     * @return int
     */
    public abstract int translateKeyCode(int keyCode);
    
    /**
     * @param ia
     * @param c
     * @return KeyHandler
     */
    static KeyHandler getKeyHandler(int[] ia, Canvas c) {
        if (ia.length == DROP) {
            return new CustomKeyHandler(ia);
        } else {
            return new DefaultKeyHandler(c);
        }     
    }
}
